Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profile: add profile_finish_ts #17636

Closed

Conversation

sluongng
Copy link
Contributor

@sluongng sluongng commented Mar 1, 2023

"date" field in Bazel json profile is a confusing field.

  • It uses Java Date.toString() output which includes local timezone
    that could be hard to parse.

  • The name is misleading since users could mistook it for profile
    start time, while it actually means the finish/end time, when
    Bazel calls the writer to serialize profiling data to disk.

Add "profile_finish_ts" which has a clearer name and more consistent
value with the time unit being used in the rest of the JSON
profile(microseconds).

We shall deprecate the "date" field in a separate patch in a major
release.

@sgowroji sgowroji added team-Documentation Documentation improvements that cannot be directly linked to other team labels awaiting-review PR is awaiting review from an assigned reviewer labels Mar 1, 2023
@sgowroji sgowroji self-requested a review March 6, 2023 09:48
@sluongng
Copy link
Contributor Author

sluongng commented Mar 8, 2023

@fweikert I think you own the Bazel profiling code, could you please take a look?

@sgowroji
Copy link
Member

sgowroji commented Mar 8, 2023

Hi @sluongng, Its already shared with @fweikert for review. I will import once approved. Thanks !

@sgowroji sgowroji added awaiting-user-response Awaiting a response from the author and removed awaiting-review PR is awaiting review from an assigned reviewer labels Mar 21, 2023
@sgowroji
Copy link
Member

Hi @sluongng, Could you please respond to the review comments and changes. Thanks!

@sluongng
Copy link
Contributor Author

It has been relatively long time so I lost part of the context for this change.

Took me a bit to review this to see why I needed it: For translating Bazel Profile to Open Telemetry data format, I need a parable time stamp.

Updated according to review feedbacks.

@sgowroji sgowroji added awaiting-review PR is awaiting review from an assigned reviewer and removed awaiting-user-response Awaiting a response from the author labels Mar 28, 2023
@sgowroji sgowroji removed their request for review March 28, 2023 10:49
@keertk keertk requested a review from meisterT March 28, 2023 18:03
@@ -167,7 +167,7 @@ Example:
{
"otherData": {
"build_id": "101bff9a-7243-4c1a-8503-9dc6ae4c3b05",
"date": "Wed Oct 26 08:22:35 CEST 2022",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the date in the example

@sgowroji sgowroji added awaiting-user-response Awaiting a response from the author and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 13, 2023
"date" field in Bazel json profile is a confusing field.

- It uses Java Date.toString() output which includes local timezone
  that could be hard to parse.

- The name is misleading since users could mistook it for profile
  start time, while it actually means the finish/end time, when
  Bazel calls the writer to serialize profiling data to disk.

Add "profile_finish_ts" which has a clearer name and more consistent
value with the time unit being used in the rest of the JSON
profile(microseconds).

We shall deprecate the "date" field in a separate patch in a major
release.
@sluongng sluongng force-pushed the sluongng/profile-otherdata-adjust branch from 6397870 to cbae4a4 Compare April 16, 2023 09:08
@sluongng sluongng changed the title profile: replace otherData.date field with profile_finish_ts profile: add profile_finish_ts Apr 16, 2023
@sluongng
Copy link
Contributor Author

@meisterT I updated both the diff and the commit message / PR summary accordingly.

Do you want to introduce the deprecation patch or shall I?
I do think removing the ambiguous field will provide a much better UX vs leaving it there.

@sgowroji sgowroji added awaiting-review PR is awaiting review from an assigned reviewer and removed awaiting-user-response Awaiting a response from the author labels Apr 17, 2023
@meisterT meisterT removed the awaiting-review PR is awaiting review from an assigned reviewer label Apr 17, 2023
@meisterT meisterT added the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 17, 2023
@meisterT
Copy link
Member

@meisterT I updated both the diff and the commit message / PR summary accordingly.

Thanks!

Do you want to introduce the deprecation patch or shall I? I do think removing the ambiguous field will provide a much better UX vs leaving it there.

Feel free to send a separate PR for this!

@Pavank1992 Pavank1992 removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 17, 2023
@brentleyjones
Copy link
Contributor

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Apr 17, 2023
@keertk
Copy link
Member

keertk commented Apr 17, 2023

@bazel-io fork 6.2.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Apr 17, 2023
@keertk
Copy link
Member

keertk commented Apr 17, 2023

Hi @sluongng if we want to include this in 6.2.0, it looks like some other commits need to be cherry-picked first (e.g. eb279aa?). Could you please submit a PR against the release-6.2.0 branch with the required changes? Or let me know what's needed and I can do it. Thanks!
cc @meisterT

@meisterT
Copy link
Member

There were many changes we did not cherry pick into 6.1. If we want this functionality in 6.2, I think the easiest is to repeat the spirit of this change instead of cherrypicking other changes.

@sluongng
Copy link
Contributor Author

Recreated in #18129

@sluongng sluongng deleted the sluongng/profile-otherdata-adjust branch April 18, 2023 08:46
sluongng added a commit to sluongng/bazel that referenced this pull request Apr 18, 2023
Repeating change from bazelbuild#17636 for 6.2 release
fweikert pushed a commit to fweikert/bazel that referenced this pull request May 25, 2023
"date" field in Bazel json profile is a confusing field.

- It uses Java Date.toString() output which includes local timezone
  that could be hard to parse.

- The name is misleading since users could mistook it for profile
  start time, while it actually means the finish/end time, when
  Bazel calls the writer to serialize profiling data to disk.

Add "profile_finish_ts" which has a clearer name and more consistent
value with the time unit being used in the rest of the JSON
profile(microseconds).

We shall deprecate the "date" field in a separate patch in a major
release.

Closes bazelbuild#17636.

PiperOrigin-RevId: 524817808
Change-Id: I89e144d42f0e608818507f5f9f9bc525c9dc7ac3
@timothyg-stripe
Copy link
Contributor

timothyg-stripe commented May 22, 2024

Hi @sluongng, I don't think this change is correct. You wrote that

The name is misleading since users could mistook it for profile start time, while it actually means the finish/end time, when Bazel calls the writer to serialize profiling data to disk.

but this method is actually called at the beginning of the Bazel process.

Additionally, profile_finish_ts lacks precision compared to date. On JDK 17, Instant.now().toString() gives us microsecond precision on Linux, while profile_finish_ts is rounded to the second.

Edit: Filed a ticket: #22505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Documentation Documentation improvements that cannot be directly linked to other team labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants